﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TemplateWeb.Models.ViewModels.SachViewModel>" %>
<%
    var lstSach = Model.GetModel.LstObjModel.ToList();
    var numRow = lstSach.Count % 4 == 0 ? lstSach.Count / 4 : (lstSach.Count / 4 + 1);
%>
<% var ItemIndex = 0;
   for (int i = 0; i < numRow; i++)
   { %>
<div class="product_list">
    <% for (int j = ItemIndex; j < lstSach.Count; j++)
       { %>
    <div class="prod_item">
        <center>
            <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lstSach[j].ID }) %>">
                <img src="../../Content/Images/Items/<%= lstSach[j].SanPham.HinhMinhHoa %>" alt="<%= lstSach[j].SanPham.TenSanPham %>"
                    width="120" height="160"></a>
            <p class="prod_name">
                <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lstSach[j].ID }) %>">
                    <%= lstSach[j].SanPham.TenSanPham%></a></p>
            <p class="font_price">
                Giá bìa:
                <%= string.Format("{0:0,0}", lstSach[j].SanPham.GiaBan)%>
                ₫</p>
        </center>
    </div>
    <% ItemIndex++;
       if (ItemIndex > 0 && ItemIndex % 4 == 0)
       {
           break;
       }
        } %>
</div>
<% } %>